﻿IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'P_UpdateBasicReference')
	BEGIN
		DROP  Procedure  esf_sso.P_UpdateBasicReference
	END
GO


CREATE Procedure esf_sso.P_UpdateBasicReference
(
	@pBasicReferenceID		BIGINT
	
	,@pBasicReferenceTypeID	INT
	,@pCode					VARCHAR (500)
	,@pName					VARCHAR (500)
	,@pDescription			VARCHAR (1000) = NULL
	,@pExtra_I				VARCHAR (500) = NULL
	,@pExtra_II				VARCHAR (500) = NULL
	,@pExtra_III			VARCHAR (500) = NULL
	,@pIsEnabled			BIT = 1
	
	,@pUserLastUpdateAlias	VARCHAR (20) = 'root'
	,@pLastUpdateDateTime	DATETIME = NULL
)
AS

	IF @pLastUpdateDateTime IS NULL
	BEGIN
		SET @pLastUpdateDateTime = GETDATE ()
	END

	DECLARE @locationID   INT
	

	UPDATE [esf_sso].[BasicReference]
    SET
		[BasicReferenceTypeID] = @pBasicReferenceTypeID
		,[Code] = @pCode
		,[Name] = @pName
		,Extra_I = @pExtra_I
		,Extra_II = @pExtra_II
		,Extra_III = @pExtra_III
		,[Description] = @pDescription
		,[IsEnabled] = @pIsEnabled
		,[LastUpdateDATETIME] = @pLastUpdateDateTime
		,[UserLastUpdateAlias] = @pUserLastUpdateAlias
     WHERE
		ID = @pBasicReferenceID
	
GO